/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.svh.Dao.Impl;

import com.svh.Dao.ConstDao;
import com.svh.Entidad.Const;
import com.svh.Utils.IConexion;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author Luis Alonso Ballena Garcia
 */
public class ConstDaoImpl extends HibernateImpl<Const> implements ConstDao<Const>{

    public ConstDaoImpl(IConexion conexion) {
        super(conexion);
    }

    @Override
    public Const obtenerConst(String tabla, String campo , int valor) {
        Const auxConst = null;
        Session session =conexion.getSession();
        Criteria criteria = session.createCriteria(Const.class,"constante").add(Restrictions.eq("constante.id.tabla", tabla))
                .add(Restrictions.eq("constante.id.campo",campo)).add(Restrictions.eq("constante.id.valor", valor));
        auxConst = (Const) criteria.uniqueResult();
        return auxConst;
    }
    
    
    
}
